package javase.array;

import java.util.Arrays;
import java.util.Scanner;

public class ArrRollback {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 3, 5, 6, 8, 98, 5};
//        for (int i = 0, j = arr.length - 1; i < j; i++, j--) {
//            int temp = arr[i];
//            arr[i] = arr[j];
//            arr[j] = temp;
//        }
//        System.out.println(Arrays.toString(arr));
//        int[] newarr=new int[arr.length<<1];
//        System.out.println(arr.length);
//        System.out.println(newarr.length);
        int[] newarr = new int[arr.length - 1];
        System.out.println(Arrays.toString(arr));
        Scanner sc = new Scanner(System.in);
        System.out.println("你想删除第几个数:");
        int del = sc.nextInt();
        for (int i = 0; i < del-1; i++) {
            newarr[i] = arr[i];
        }
        for (int i = del-1; i < newarr.length; i++) {
            newarr[i]=arr[i+1];
        }
        System.out.println(Arrays.toString(newarr));
        sc.close();
    }
}
